
import { defineStore } from 'pinia'

export const globalStore = defineStore('global', {
  state: () => {
    return {
      dataList: [],
      //财务报表报送种类首页选择的日期范围
      dateRange: {
        title: '',
        startDate: '',
        endDate: ''
      },
      // 财务报表报送种类页面需要持久化存储防止丢失的数据
      //报送期间日期区间
      theDateRangeOfTheSubmissionPeriod: {
        startDate: '2025-01-01',
        endDate: '2025-12-31'
      },
      // 季度选择器选中的季度
      // 初始化值为 2024 年 第三季度:如'2024-Q3'
      selectedQuarter: '2024-Q3',
      // 报送期间单选按钮组绑定值
      reportRadio: 1,
      //默认选中的模块
      selectedModule: 1,
      // 模块列表3xn grid布局
      modulesList: [
        { id: 1, title: '财报导入', content: '导入标准模板表单', selected: true, },
        { id: 2, title: '财报转换', content: '转换财务软件导出的报表', selected: false, },
        { id: 3, title: '在线填写', content: '在线填写申报表', selected: false, },
      ],
      //理论题列表
      questionList: [
        { id: 1, number: 1, status: 'done' },
        { id: 2, number: 2, status: 'done' },
        { id: 3, number: 3, status: 'error' },
        { id: 4, number: 4, status: 'notDone', isClicked: true },
        { id: 5, number: 5, status: 'notDone' },
        { id: 6, number: 6, status: 'notDone' },
      ],
      //当前选中的理论题
      currentSelectedItem: { id: 4, number: 4, status: 'notDone', isClicked: true }
    }
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'globalStorage',
        storage: localStorage,//浏览器的本地存储
        paths: ['dataList', 'dateRange', 'theDateRangeOfTheSubmissionPeriod', 'selectedQuarter', 'reportRadio',
          'selectedModule', 'modulesList', 'currentSelectedItem'
        ]//将指定的进行本地存储
      }
    ]
  }
})
